package com.zhoutao.blog.seven.dao.model;

import com.baomidou.mybatisplus.annotation.IdType;
import com.baomidou.mybatisplus.annotation.TableField;
import com.baomidou.mybatisplus.annotation.TableId;
import com.baomidou.mybatisplus.annotation.TableName;
import lombok.Data;

import java.time.LocalDateTime;

@Data
@TableName("article")
public class ArticleDao {

    @TableId(type = IdType.AUTO)
    private Long id;

    private String title;

    private String avatar;

    private String description;

    @TableField("`keys`")
    private String keys;

    private String content;

    private String type;

    private String mkContent;

    private String icon;

    private Integer readCount;

    private Integer commentCount;

    private Boolean top;

    private Long categoryId;

    private LocalDateTime createdAt;

    private LocalDateTime updatedAt;

    public String findAvatar() {
        if (this.avatar == null || this.avatar.trim().length() == 0) {
            return null;
        }
        return this.avatar;
    }
}
